import java.util.Arrays;


public class StringManipulator
{

    public static String reverseString(String str) {
        
        int size = str.length();
        char[] charArray = new char[size];
        
        for(int i = size-1, j = 0; i >= 0; i--, j++) {
            char c = str.charAt(i);
            charArray[j] = c;
        }
        
        return Arrays.toString(charArray);
    }
    
    public static String reverseWords(String str) {
        
        String[] stringArray = str.split(" ");
        String reverseString = "";
        
        for(int i = stringArray.length-1; i >= 0; i--) {
            reverseString += stringArray[i];
            reverseString += " ";
        }
        
        return reverseString;
    }
}
